//
//  ZLWBaseModel.m
//  Otaku
//
//  Created by lanou3g on 16/5/12.
//  Copyright © 2016年 Liuwx. All rights reserved.
//

#import "ZLWBaseModel.h"
#import "ZLW_RecommentModel.h"
#import "ZLW_TextModel.h"
#import "ZLW_VideoModel.h"

@implementation ZLWBaseModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

-(void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"user"]) {
        [self setValuesForKeysWithDictionary:value];
    }
 
    
}
+ (instancetype)modleWith: (NSDictionary *)dictionary
{
    if (dictionary[@"group"][@"large_image"]) {
        ZLW_RecommentModel *text = [ZLW_RecommentModel new];
       [text setValuesForKeysWithDictionary:dictionary[@"group"]];
       return text;
    }else if (dictionary[@"group"][@"mp4_url"]){
        ZLW_VideoModel *text = [ZLW_VideoModel new];
        [text setValuesForKeysWithDictionary:dictionary[@"group"]];
             return text;
        
    }else
    {
        ZLW_TextModel *text = [ZLW_TextModel new];
       [text setValuesForKeysWithDictionary:dictionary[@"group"]];
           return text;
    }
    
    return nil;
}


@end
